import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    Dimensions,
    ListView,
    TouchableOpacity,
    Platform,
    TextInput
} from 'react-native';

const {height, width} = Dimensions.get('window');
export default class InputLabelCompany extends Component {
    constructor(props) {
        super(props);
        this.state = {}
    };

    render() {
        const {text,number,secureTextEntry,value}=this.props;
        return (
            <View style={styles.labelView}>
                <View style={styles.labelLeftView}>
                    <Text style={styles.labelLeftMsg}>{text}</Text>
                </View>
                <TextInput ref={ (ref)=>this.TextInput = ref }
                           autoCapitalize={"none"}
                           defaultValue={value}
                           placeholder={'请输入您的'+text}
                           maxLength={number}
                           selectionColor={'#3e6ee6'}
                           underlineColorAndroid={'transparent'}
                           placeholderTextColor='#bbbbbb'
                           autoCorrect={false}
                           secureTextEntry={secureTextEntry}
                           style={styles.textInputView}
                           onChangeText={(text)=>{
                               if(this.props.inputMsg){
                                   this.props.inputMsg(text)
                               }
                           }}/>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#f0f0f0'
    },
    textInputView:{
        height:44,
        padding:0,
        flex:1,
        fontSize:15,
    },
    labelView:{
        height:44,
        flexDirection:'row',
        alignItems:'center',
        borderBottomWidth:1,
        borderColor:'#d6d6d6',
        width:width-60,
        marginLeft:30
    },
    labelLeftView:{
        width:48,
        alignItems:'center',
        flexDirection:'row',
        justifyContent:'center'
    },
    labelLeftMsg:{
        color:'#000000',
        fontSize:18,
    }
});
